package com.lp.user.mapper;

import com.lp.model.entity.user.UserFollow;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface UserFollowMapper {

    //获取用户关注数量
    Integer selectFollowCountByFollowerId(@Param("followerId") Long followerId);

    //获取用户粉丝数量
    Integer selectFansCountByFollowedId(@Param("followedId") Long followedId);

    //获取粉丝 id 列表
    List<Long> selectFansListByFollowedId(@Param("followedId") Long followedId,
    @Param("limit") Integer limit, @Param("offset") Integer offset);

    //获取关注 id 列表
    List<Long> selectFollowListByFollowedId(@Param("followerId") Long followerId,
    @Param("limit") Integer limit, @Param("offset") Integer offset);

    //新增关注信息
    void add(@Param("followerId") Long followerId, @Param("followedId") Long followedId);

    //删除关注信息
    void delete(@Param("followerId") Long followerId, @Param("followedId") Long followedId);

    UserFollow selectFollowById(@Param("followerId") Long followerId,
                                @Param("followedId") Long followedId);

    //根据被关注者 id 获取总粉丝量
    Long selectFansTotalByFollowedId(@Param("followedId") Long followedId);

    //根据关注者 id 获取总关注数量
    Long selectFollowTotalByFollowerId(@Param("followerId") Long followerId);

}
